perm filename TEXF20.SAI[TEX,SYS] blob
sn#500242 filedate 1981-01-05 generic text, type T, neo UTF8
comment This module is TENEX/TOPS-20 compatible.
comment Generated by LTP on MAY-1-79;
saf string array fname[0:2] # file directory, name, and extension;
integer !count!; # input buffer size;
procedure scanfilename # sets up fname[0:2];
begin label name!is!in;
procedure append (reference string s);
begin
if curcmd = spacer then go to name!is!in;
if curcmd >= charcodes then begin
backerror ("Blank space should follow file name");
go to name!is!in;
end;
s := s & curchar;
getnctok;
end;
fname[0]←fname[1]←fname[2]←null;
getnctok;
if curchar = "<" then begin
while curchar neq ">" do append (fname[0]);
append (fname[0]); # appends the ">";
end;
while curchar neq "." do append (fname[1]);
while true do append (fname[2]);
name!is!in:
end;
internal procedure inputfile;
begin comment "\input" has just been scanned. This procedure scans
the user's file name, employing naming conventions common to both
TENEX and TOPS-20, then reads in the first line and feeds it to the
input system;
integer chan;
label abort # if something goes wrong trying to read the file;
boolean firsttry # first attempt to read the file;
string flname;
define checkeof=⊂if eof then begin print(")");go to abort end⊃;
firsttry←true;
while true do begin
scanfilename;
if fname[2]=0 then fname[2]←".TEX" # default extension;
flname←fname[0]&fname[1]&fname[2];
if (chan:= openfile (flname,"RE")) < 0 and fname[0] = 0 then begin
comment if lookup failed and no explicit directory was given,
try default library area;
flname := libraryarea & flname;
chan := openfile (flname, "RE");
end;
if chan<0
then begin
error("Open failed on file "&flname);
if firsttry
then begin firsttry←false; continue; end
else
return;
end
else done;
end;
print(" (",flname);
pushinput # save present file status;
state←newline; recovery←chan; filename←flname;
setinput (chan, !count!:= 200, brchar, eof);
inbuf←input(chan,crffbreak) # get first line of file;
checkeof; print(" 1");
if equ(inbuf[1 to 9],"COMMENT ⊗") then
begin comment Skip TVedit directory page;
while brchar≠'14 and not eof do inbuf←input(chan,ffbreak);
checkeof;
inbuf←input(chan,crffbreak) # get first line of second page;
checkeof; print(" 2");
loc ← (2 lsh infod) + 1 # page 2 line 1;
end
else loc ← (1 lsh infod) + 1 # page 1 line 1;
if tracing land '20 then
begin integer p # garbage bin;
if inbuf='12 then p←lop(inbuf);
if length(inbuf)=1 then inbuf←" "&inbuf;
print(nextline);
outstr(inbuf[1 to ∞-1]) # show inbuf on screen;
inbuf←inchwl&inbuf[∞ to ∞];
end;
curbuf←inbuf;
comment Now define the output file name if it hasn't yet been defined;
if ofilname=0 then declareofil(fname[1]&ofilext) # no explicit directory here;
return;
abort: release(chan);
popinput;
end;
internal procedure definefont(integer f) # Do this after seeing "=" of font def;
begin integer n,p,chan; string s;
boolean firsttry # first attempt to read the file;
firsttry←true;
loop begin scanfilename;
s←fname[0]&fname[1] # without extension;
if fontname[f] and not equ(s,fontname[f]) then
begin error("Sorry, this font code is already defined to be "&
fontname[f]);
return;
end;
fontname[f]←s;
if fname[0]=0 then fname[0]←libraryarea # for later open;
if parbase[f]=0 then
begin comment font information not preloaded;
open (chan ← getchan, "DSK", 8, 2, 0, 0, 0, eof);
lookup (chan, s← fname[0]&fname[1]&deviceext, eof);
if eof then
begin error("Lookup failed on file "&s);
release(chan);
if firsttry then
begin firsttry←false; continue;
end;
quit;
end;
readfontinfo(chan,f) # input font info for use by TEXSEM and TEXOUT;
release(chan);
end;
done;
end;
p←fontglue+f*gluespecsize # location of "font glue";
mem[p]←1000000 lsh infod # "infinite" reference count;
gluespace(p)←fontpar(f,spacewd);
gluestretch(p)←fontpar(f,spacestr);
glueshrink(p)←fontpar(f,spaceshr);
end;